package cn.wegoteam.shop.po;

import static javax.persistence.GenerationType.IDENTITY;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import cn.wegoteam.shop.enu.StoreType;

/**
 * Store entity. @author MyEclipse Persistence Tools 收藏表
 */
@Entity
@Table(name = "store", catalog = "shop")
public class Store  extends BasePo implements java.io.Serializable {

	// Fields

	private Integer id;
	private User user;
	private Product product;
	private Timestamp storeTime;// 收藏时间
	private StoreType type;//收藏类型
	private Integer flag;// 标识位
    
	// Constructors

	/** default constructor */
	public Store() {
	}

	/** full constructor */
	public Store(User user, Product product, Timestamp storeTime, Integer flag,StoreType type) {
		this.user = user;
		this.product = product;
		this.storeTime = storeTime;
		this.flag = flag;
		this.type=type;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "uid")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "pid")
	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	@Column(name = "storeTime", length = 25,nullable = true,insertable=false)
	public Timestamp getStoreTime() {
		return this.storeTime;
	}

	public void setStoreTime(Timestamp storeTime) {
		this.storeTime = storeTime;
	}

	@Column(name = "flag",insertable=false,nullable=false)
	public Integer getFlag() {
		return this.flag;
	}

	public void setFlag(Integer flag) {
		this.flag = flag;
	}
    @Column(name="type",length=12,nullable = true)
    @Enumerated(EnumType.STRING)
	public StoreType getType() {
		return type;
	}

	public void setType(StoreType type) {
		this.type = type;
	}

}